package com.example.mapper;

import com.example.entry.Student;
import com.example.entry.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface MainMapper {

    @Select("select * from users where username=#{username}&&password=#{password}")
    User findUser(@Param("username")String username,@Param("password")String password);

    @Select("select *from message where name like #{name}")
    List<Student> bookList(@Param("name") String name);

    @Select("select * from message where id=#{id}")
    Student findByID(@Param("id") int id);

    @Delete("delete from message where id=#{id}")
    void Del(@Param("id") int id);

    @Insert("insert into message values (null, #{name} , #{no} , #{sex} , #{clas}, #{tel}, #{adde}, #{coll})")
    void add(@Param("name") String name, @Param("no") String no, @Param("sex") String sex, @Param("clas") String clas, @Param("tel") String tel, @Param("adde") String adde, @Param("coll") String coll);

    @Update("update message set name=#{name} , no=#{no} , sex=#{sex}, clas=#{clas}, tel=#{tel}, adde=#{adde}, coll=#{coll} where id=#{id}")
    void update(@Param("name") String name, @Param("no") String no, @Param("sex") String sex, @Param("clas") String clas, @Param("tel") String tel, @Param("adde") String adde, @Param("coll") String coll,@Param("id")int id);


}
